﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;

namespace 语音识别
{
    public class WebClientUtil
    {
        public async static Task<string> GetWithHeader(string url)
        {
            HttpClient client = new HttpClient();
            return await client.GetStringAsync(url);
        }

        public async static Task<string> Get(string url, string queryString)
        {
            HttpClient client = new HttpClient();
            string result = string.Empty;
            HttpResponseMessage response = await client.GetAsync(url + queryString);
            if (response.IsSuccessStatusCode)
            {
                result = await response.Content.ReadAsStringAsync();
            }
            return result;
        }
    }
}
